<%-- 
    Document   : more_content
    Created on : Sep 29, 2010, 6:30:59 PM
    Author     : M Bilal
--%>

<%@page import="wap.rockvilletech.portal.DBProc"%>
<%@ page import="java.io.*,java.sql.*,java.net.*"%>
<%@ page import="org.apache.log4j.Logger" %>

<% final Logger log = Logger.getLogger("JSP.INDEX");%>

<%@ include file="../includes/header.jspf"%>


<%
DBProc dbproc=DBProc.getInstance();
int intBlockLength = 5, intRecordsToBeDisplayed = 0, intRecordsToBeFetched = 0, intCountTotal = 0, intPageID = 0, intLastPage = 0;
	String strPagingLinks = "", pid = "",catid="";
	boolean computePaging = false, isNext = true;
	pid = request.getParameter("pid") != null ? request.getParameter("pid").toString() : "0";
        catid =request.getParameter("catid") != null ? request.getParameter("catid").toString() : "";
String strThisPageName="more_content.jsp",strCatID="";
thisPage="more_content.jsp";
String strPageTitle_thisCat=strTitle;
String nav_Extra = "";

        try{strCatID = ( request.getParameter("CatID").trim() );}catch(Exception ex){strCatID="";}
        try{strAppMainCat = request.getParameter("MainCat").trim();}catch(Exception ex){strAppMainCat = "";}
        try{strAppCatType = request.getParameter("CatType").trim();}catch(Exception ex){strAppCatType = "";}
        try{strAppFOrS= request.getParameter("FOrS").trim();}catch(Exception ex){strAppFOrS = "";}
        if(strAppCatType.equalsIgnoreCase("wallpapers") || strAppCatType.equalsIgnoreCase("animated")
                || strAppCatType.equalsIgnoreCase("games") || strAppCatType.equalsIgnoreCase("videos")
                || strAppCatType.equalsIgnoreCase("themes") || strAppCatType.equalsIgnoreCase("polytones")
                || strAppCatType.equalsIgnoreCase("truetones")) {
            nav_Extra = strAppCatType;
        }
       
%>
<%@ include file="../includes/navigationLinks.jspf" %>
<div align="center">
<%--
        <div style="padding-top:10px;background-image:url('../images/new/top_bar.jpg');background-repeat: repeat-x;background-position:0% 350%;" title="horizontal icon">
            <a href="<%=context_Path%>/index.jsp"><img src='<%=context_Path%>/imgsrv?img=home<%=sImgFix%>.jpg&repo=PI&s=0&w=<%=mainButtonImgWidth%>' alt="home"></a>
            <img src='<%=context_Path%>/imgsrv?img=downloads_selected<%=sImgFix%>.jpg&repo=PI&s=0&w=<%=mainButtonImgWidth%>' alt="downloads">
            <a href="<%=context_Path%>/coolstuff/index.jsp"><img src='<%=context_Path%>/imgsrv?img=cool_stuff<%=sImgFix%>.jpg&repo=PI&s=0&w=<%=mainButtonImgWidth%>' alt="coolstuff"></a>
            <a href="<%=context_Path%>/news/news.jsp"><img src='<%=context_Path%>/imgsrv?img=news<%=sImgFix%>.jpg&repo=PI&s=0&w=<%=mainButtonImgWidth%>' alt="news"></a>
        </div>
--%>
        <div style="padding-top: 10px;" align="center">
            <table width="100%" align="center" cellpadding="0" cellspacing="0" style="text-align: center;font-weight: bold;">
                <tr >
                    <td style="background-image:url('../images/new/top_bar_02.jpg');background-repeat: repeat-x;">
                        Islamic
                    </td>
                    <td style="background-image:url('../images/new/top_bar_02.jpg');background-repeat: repeat-x;">
                        <img alt="" src="../images/new/top_bar_02_seperator.jpg">
                    </td>
                    <td style="background-image:url('../images/new/top_bar_02.jpg');background-repeat: repeat-x;">
                        Bollywood
                    </td>
                    <td style="background-image:url('../images/new/top_bar_02.jpg');background-repeat: repeat-x;">
                        <img alt="" src="../images/new/top_bar_02_seperator.jpg">
                    </td>
                    <td style="background-image:url('../images/new/top_bar_02.jpg');background-repeat: repeat-x;">
                        Western
                    </td>
                    <td style="background-image:url('../images/new/top_bar_02.jpg');background-repeat: repeat-x;">
                        <img alt="" src="../images/new/top_bar_02_seperator.jpg">
                    </td>
                    <td style="background-image:url('../images/new/top_bar_02.jpg');background-repeat: repeat-x;">
                        Pakistani
                    </td>
                </tr>
            </table>
        </div>



<%
 Vector vContent=dbproc.getMoreContent(pid, catid);
        if(!vContent.isEmpty()){
                intCountTotal=(Integer)vContent.get(0);
        intRecordsToBeDisplayed=intRecordsToBeFetched=(Integer)(vContent.get(1));
	try {
		intLastPage = intCountTotal / intRecordsToBeDisplayed;
		intPageID = Integer.parseInt(pid.toString());
		if (intPageID > intLastPage) {
	        intPageID = intLastPage;
	    }
		if(intCountTotal == (int)(intRecordsToBeDisplayed*(intPageID+1))) intLastPage--;
    } catch(NumberFormatException ex){
    }

    if (vContent.size()-1 < intRecordsToBeFetched) {
		intRecordsToBeDisplayed -= (intRecordsToBeFetched - vContent.size());
		intRecordsToBeFetched = vContent.size();
		isNext = false;
	}

        }
  computePaging = vContent.size() <= 2 ? false : true;
if(computePaging) {
%>
<div style="padding:10px 0px 10px 0px;">
   	   <%
       try {
	       String strCid ="",strCImage="",strCName="",strCPrice="",strCType="";
	       String[] arrContent=null;
           for (int idx = 2; idx < vContent.size(); idx++) {
               arrContent =(String[]) vContent.get(idx);
               strCid=arrContent[0];
               strCName=arrContent[1];
               strCImage=arrContent[2];
               strCPrice=arrContent[3];
               strCType=arrContent[5];

            %>
            <a class="LinkIndex" href="<%=request.getContextPath()%>/content/dload.jsp?pid=<%=pid%>&cid=<%=strCid%>&catid=<%=catid%>">
            <%if(strCImage.length()<2){
                out.println(strCName+"<br/>");
            }else{%>
                 <img src='<%=context_Path%>/imgsrv?img=<%=strCImage%>&repo=&s=0&w=<%=iconSize%>' alt='' />
            <%}%>
            </a>
	<%
          }
	%>
        </div>
        <div>
           <%	// Call the method which will generate Page links
		wap.rockvilletech.util.Paging.computePaging(request, "more_content.jsp?",
				intRecordsToBeFetched, intRecordsToBeDisplayed,
				intCountTotal, intBlockLength, intLastPage, intPageID,
				isNext);
		strPagingLinks = wap.rockvilletech.util.Paging.getPagingLinks();
		out.println(strPagingLinks);
       } catch (Exception ex) {
           log.error("JSP,MoreContent"+ex);
       }
       %>
           </div>


<%
}
%>





<%--
    <div style="padding-top: 5px;">

        <img src='<%=context_Path%>/imgsrv?img=community.jpg&repo=PI&s=0&w=<%=mainButtonImgWidth%>' alt="community">
        <img src='<%=context_Path%>/imgsrv?img=religion.jpg&repo=PI&s=0&w=<%=mainButtonImgWidth%>' alt="religion">
        <img src='<%=context_Path%>/imgsrv?img=utunes.jpg&repo=PI&s=0&w=<%=mainButtonImgWidth%>' alt="horoscope">
        <img src='<%=context_Path%>/imgsrv?img=sports.jpg&repo=PI&s=0&w=<%=mainButtonImgWidth%>' alt="sports">


    </div>
--%>


</div>
<%@ include file="../includes/others.jspf"%>
<%@ include file="../includes/footer.jspf"%>



<%
wpb.LogVisit(strIP, thisPage, strGsm,strApn,strBrand,strModel, app+"-"+strAppCatType,request.getQueryString());
%>